﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace ChoJu.Converters.Uc
{
    public class DelayWifiConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            long val = 0;
            var bol = long.TryParse(value?.ToString(), out val);
            if (bol == false)
                return new BitmapImage(new Uri("pack://application:,,,/Public.ResourceBase;component/images/ico/wifi_1.png"));

            if(val > 0 & val <= 100)
                return new BitmapImage(new Uri("pack://application:,,,/Public.ResourceBase;component/images/ico/wifi_6.png"));
            else if(val > 100 & val <= 150)
                return new BitmapImage(new Uri("pack://application:,,,/Public.ResourceBase;component/images/ico/wifi_5.png"));
            else if (val > 150 & val <= 200)
                return new BitmapImage(new Uri("pack://application:,,,/Public.ResourceBase;component/images/ico/wifi_4.png"));
            else if (val > 200 & val <= 300)
                return new BitmapImage(new Uri("pack://application:,,,/Public.ResourceBase;component/images/ico/wifi_3.png"));
            else
                return new BitmapImage(new Uri("pack://application:,,,/Public.ResourceBase;component/images/ico/wifi_2.png"));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
